﻿
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace AppDesigner.iUIRender
{
    public abstract class BaseUIRender
    {
        
        protected FrameworkElement _currentElement;

        #region RenderProperties
        public Panel Parent { get; set; }
        public Point Position { get; set; }
        public Size Size { get; set; }
        public PanelType ParentPanelType { get; set; }
        public string Name { get; set; }
        #endregion

        public BaseUIRender()
        {
            _currentElement = GenerateElement();
        }

        public abstract FrameworkElement GenerateElement();

        //渲染位置
        public virtual void RenderToParent()
        {
            if (ParentPanelType == PanelType.PCanvas)
            {
                RenderToCanvas();
            }
            else if (ParentPanelType == PanelType.PStackPanel)
            {
                RenderToStackPanel();
            }
            else if (ParentPanelType == PanelType.PGrid)
            {
                RenderToGrid();
            }
            else if (ParentPanelType == PanelType.PCustom)
            {
                RenderToCustom();
            }
            else
            {
                Debug.WriteLine("Not Support RenderToParent Method..");
            }
        }

        public abstract void RenderToCanvas();
        public abstract void RenderToStackPanel();
        public abstract void RenderToGrid();
        public abstract void RenderToCustom();
        //设置属性
        public abstract void RenderSelf();
    }
}
